#ifndef __CALLBACKDEFS_H__
#define __CALLBACKDEFS_H__

#include <functional>
#include <memory>
#include <chrono>

typedef std::function<void()> Callback_t;
typedef std::function<void()> Task;
// for logger's flush function
typedef std::function<void()> FlushFunc;
// for logger's output function
typedef std::function<void(const char *msg, const uint64_t len)> OutputFunc;

using TimerID = uint64_t;
using SysTime = std::chrono::system_clock;

class TimePoint;
class TcpConnection;
class MsgBuffer;
using TcpConnectionPtr = std::shared_ptr<TcpConnection>;
// for read, close, error etc.
using ConnectionCallback_t = std::function<void(const TcpConnectionPtr &)>;
// for write complete callback
using ConnectionCallbackSize_t =
    std::function<void(const TcpConnectionPtr &, size_t)>;
// for receive message callback
using ConnectionCallbackBuffer_t =
    std::function<void(const TcpConnectionPtr &, MsgBuffer *, TimePoint)>;

void defaultConnectionCallback(const TcpConnectionPtr &);
void defaultMessageCallback(const TcpConnectionPtr &, MsgBuffer *, TimePoint);

#endif  // __CALLBACKDEFS_H__